import 'package:favoritecate/core/viewmodel/favor_meal_viewmodel.dart';
import 'package:favoritecate/ui/widgets/meal_item.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

class FYFavorMealContent extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Consumer<FYFavorMealViewModel>(
      builder: (ctx,favor,child){

        if(favor.favorMeals.length == 0){
          return Center(
            child: Text('未收藏美食'),
          );
        }

        return ListView.builder(
            itemCount: favor.favorMeals.length,
            itemBuilder:(ctx,index){
              return FYMealItem(favor.favorMeals[index]);
            }
        );
      },
    );
  }
}
